function like(item, entityType, entityId, entityUserId, postId) {
    $.post(
        CONTEXT_PATH + "/like",
        {
            "entityType": entityType,
            "entityId": entityId,
            "entityUserId": entityUserId,
            "postId":postId
        },
        function (data) {
            data = $.parseJSON(data);
            if (data.code == 0) {
                console.log(data)
                $(item).children("i").text(data.likeCount);
                $(item).children("b").text(data.likeStatus == 1 ? '已赞' : '赞');

            } else {
                alert(data.msg);
            }
        }
    )
}

$(function () {
   $("#topBtn").click(setTop)
   $("#wonderfulBtn").click(setWonderful)
   $("#deleteBtn").click(setDelete)
});

function setTop() {
    var postId = $("#postId").val()
    $.post(
        CONTEXT_PATH + "/discuss/top",
        {"id": postId},
        function (data) {
            data = $.parseJSON(data);
            if (data.code == 0) {
                $("#topBtn").attr("disabled", "disabled")
                alert("置顶成功！")
            } else {
                alert(data.msg);
            }
        }
    )
}
function setWonderful() {
    var postId = $("#postId").val();
    $.post(
        CONTEXT_PATH + "/discuss/wonderful",
        {"id": postId},
        function (data) {
            data = $.parseJSON(data);
            if (data.code == 0) {
                $("#wonderfulBtn").attr("disabled", "disabled")
            } else {
                alert(data.msg);
            }
        }
    )
}
function setDelete() {
    var postId = $("#postId").val()
    $.post(
        CONTEXT_PATH + "/discuss/delete",
        {"id": postId},
        function (data) {
            data = $.parseJSON(data);
            if (data.code == 0) {
                location.href = CONTEXT_PATH + "/index";
            } else {
                alert(data.msg);
            }
        }
    )
}